home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / IM_3 .adf / Exec / piarc.LZH / resolver.rexx < prev    next >
OS/2 REXX Batch file  |  1992-08-20  |  4KB  |  188 lines

  1. /*
  2.  * RESOLVER.rexx  a P.I. module to display the Image from Imagemaster
  3.  *               or Image Professional on DMI's Resolver.
  4.  *               
  5.  *
  6.  *  Written by: Barry Chalmers
  7.  * Last Update: May 7th, 1992
  8.  *         For: Black Belt Systems image processing series IM, IM F/c, and IP.
  9.  * ---------------------------------------------------------------------------
  10.  *    Revision: 1.00  Nov 10, 1991 - Initial release.
  11.  *              1.01  Feb  8, 1992 - SAGE support.
  12.  *              1.02  May  7, 1992 - Selective redraw;
  13.  *                                   Preset EDD draw mode.
  14.  *                                   Requires IM 9.11 or later.
  15.  */
  16. parse arg jackin dx1 dy1 dx2 dy2
  17.  
  18. import = 'IM_Port';
  19. rrport = 'IMRES8';
  20.  
  21. if jackin = 'finish' then
  22.   do
  23.     plist = showlist('p');
  24.     if index(plist,'IMRES8') > 0 then
  25.       do
  26.         address('IMRES8');
  27.         'finish';
  28.       end
  29.     exit 0;
  30.   end
  31. else if jackin > 0 then
  32.   do
  33.     redraw = 1;
  34.   end
  35. else
  36.   do
  37.     redraw = 0;
  38.     address(import);
  39.     options results;
  40.     'jackin';
  41.     jackin = result;
  42.     options;
  43.   end
  44.  
  45. /*
  46.  * open rexxsupport.library -- needed for some functions
  47.  */
  48. if ~show('L',"rexxsupport.library") then do
  49.   if addlib('rexxsupport.library',0,-30,0) then do
  50.       /* everything's ok */
  51.     end;
  52.   else do
  53.     say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
  54.     say 'Cannot operate RESOLVER.rexx without this library - sorry!';
  55.     exit 10;
  56.     end;
  57.   end;
  58.  
  59.  
  60.  
  61. plist = showlist('p');
  62. if index(plist,'IMRES8') = 0 then
  63.   do
  64.     cmdpath = 'c:';
  65.     if open(fhandle,'rexx:picmdpath','read') then  /* open the file */
  66.       do
  67.         cmdpath = readln(fhandle);
  68.         call close(fhandle);  /* close the file    */
  69.       end
  70.     
  71.     /* say 'RESOLVE being started'; ***/
  72.     address command 'run '||cmdpath||'resolve '||jackin;
  73.     looper = 'run';
  74.     loopc = 0;
  75.     do while looper = 'run'
  76.       loopc = loopc + 1;
  77.       call delay(50);
  78.       plist = showlist('p');
  79.       if index(plist,'IMRES8') = 0 then
  80.         do
  81.           if loopc = 60 then
  82.             do
  83.               say "Can't start the RESOLVE program!";
  84.               exit 10
  85.             end
  86.         end
  87.       else
  88.         do
  89.           looper = 'go';
  90.         end
  91.     end
  92.     /* ASK ALL THE HARD QUESTIONS   HERE   */
  93.     
  94.     address(rrport);
  95.     'jack '||jackin;
  96.  
  97.     
  98.     address(import);
  99.     options results;
  100.     if redraw > 0 then
  101.       'gadgets "DMI Resolver","Display in Luma","Preset","Ordered","Preset","EDD"';
  102.     else
  103.       'gadgets "DMI Resolver","Display in Luma","Preset","Ordered","Preset","EDD","Chosen","EDD"';
  104.     rcolor = result-1;
  105.     options;
  106.     if rcolor < 0 then
  107.       do
  108.         address;
  109.         exit 0;
  110.       end
  111.     address(rrport);
  112.     'color '||rcolor;
  113.     
  114.     address(rrport);
  115.     'progress 2';
  116.  
  117.     address(import);
  118.     bufname = 'unnamed';
  119.     options results;
  120.     'current';
  121.     bufdata = result; /* get name of buffer, if there is one */
  122.     parse var bufdata bname ',' bnum ',' bx ',' by ',' btot ',' bmem ',' bparname ',' bparnum;
  123.     if bname ~= '<none>' then
  124.       do
  125.         bufname = bname;
  126.       end
  127.     address(rrport);
  128.     'name '||bufname;
  129.  
  130.     address;
  131.     mode = 0;
  132.     i = 0;
  133.     pstr = "";
  134.     if EXISTS('ram:IMRESOLVERMODES.dat') = 1 then do
  135.         call OPEN(fhandle,'ram:IMRESOLVERMODES.dat','read');
  136.         do while EOF(fhandle) = 0
  137.             line = READLN(fhandle);
  138.             if EOF(fhandle) = 0 then do
  139.                 parse var line xres ',' yres ',' dmode
  140.                 xress.i = xres;
  141.                 yress.i = yres;
  142.                 modes.i = dmode;
  143.                 if i > 0 then do
  144.                     pstr = pstr||',';
  145.                   end
  146.                 pstr = pstr||'"'||xres||' x '||yres||'",'||'"Mode '||dmode||'"';
  147.                 i = i + 1;
  148.               end
  149.           end
  150.         call CLOSE(fhandle);
  151.         address command delete||' >NIL ram:IMRESOLVERMODES.dat';
  152.         address(import);
  153.         options results;
  154.         'gadgets '||pstr;
  155.         dmires = result;
  156.         options;
  157.         if dmires = 0 then do
  158.           address;
  159.           exit 0;
  160.           end
  161.         dmires = dmires - 1;
  162.       end
  163.     mode = modes.dmires;
  164.     address(rrport);
  165.     'display '||mode;
  166.     
  167.     redraw = 0;
  168.   end
  169.  
  170.  
  171. address(rrport);
  172. if redraw > 0 then
  173.   do
  174.    'redraw '||jackin||' '||dx1||' '||dy1||' '||dx2||' '||dy2;
  175.   end
  176. else
  177.   do
  178.     'show';
  179.   end
  180.  
  181. address(import);
  182. 'finish';
  183.  
  184.  
  185. address;
  186.  
  187. exit 0;
  188.